FROM openjdk:21-oracle as builder
WORKDIR application
COPY ./v2-to-v3/v2-to-v3-start-for-base/target/*.jar app.jar
RUN java -Djarmode=layertools -jar app.jar extract && rm app.jar

FROM openjdk:21-oracle
LABEL authors="bobaoge_team"
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR application
COPY --from=builder /application/dependencies/ ./
COPY --from=builder /application/snapshot-dependencies/ ./
COPY --from=builder /application/spring-boot-loader/ ./
COPY --from=builder /application/application/ ./
EXPOSE 8080
CMD ["sh", "-c", "java --add-opens=java.base/java.lang=ALL-UNNAMED org.springframework.boot.loader.JarLauncher -Duser.timezone=Asia/Shanghai"]
